package com.dd.common.pojo.dto;

import com.dd.common.validator.annotation.ValidTimeRange;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.PastOrPresent;
import java.io.Serializable;
import java.time.LocalDateTime;


@Data
@Schema(description = "时间范围查询DTO")
@ValidTimeRange(
        start = "createdAtStart",
        end = "createdAtEnd",
        message = "创建开始时间不能晚于创建结束时间"
)
@ValidTimeRange(
        start = "updatedAtStart",
        end = "updatedAtEnd",
        message = "更新开始时间不能晚于更新结束时间"
)
public class TimeDTO implements Serializable {

    private static final long serialVersionUID = 2L;

    @PastOrPresent(message = "开始时间不能是未来时间")
    @Schema(description = "创建时间开始", type = "string", format = "date-time", example = "2024-01-01T00:00:00")
    private LocalDateTime createdAtStart;

    @Schema(description = "创建时间结束", type = "string", format = "date-time", example = "2024-12-31T23:59:59")
    private LocalDateTime createdAtEnd;

    @PastOrPresent(message = "开始时间不能是未来时间")
    @Schema(description = "更新时间开始", type = "string", format = "date-time", example = "2024-01-01T00:00:00")
    private LocalDateTime updatedAtStart;

    @Schema(description = "更新时间结束", type = "string", format = "date-time", example = "2024-12-31T23:59:59")
    private LocalDateTime updatedAtEnd;

}
